home *** CD-ROM | disk | FTP | other *** search
- Path: news.algonet.se!usenet
- From: Anders Olofsson <ao@algonet.se>
- Newsgroups: comp.lang.c
- Subject: Help with linked list needed
- Date: 28 Jan 1996 14:31:10 GMT
- Organization: AlgoNet Public Access Node, Stockholm
- Message-ID: <4eg1be$45o@prometheus.algonet.se>
- NNTP-Posting-Host: sophocles.algonet.se
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- I have a linked list like this:
-
- item_A->item_B->item_C->NULL
-
- This list is declared in function main like this:
-
- itemptr list;
-
- I have a function that deletes the first item in the list
-
- void deleteitem (itemptr *l);
-
-
-
- Now, if I call deleteitem 3 times from function main with list as
- parameter the list will point to NULL.
-
- I.e:
-
- deleteitem (&list);
- deleteitem (&list);
- deleteitem (&list);
-
- gives:
-
- list->NULL
-
-
-
- But if I call deleteitem from another function than main it will
- not work. How do I overcome this problem???...
-
-
- -- Anders Olofsson
- ao@algonet.se
-